package org.mixare.gui;


import org.mixare.MixView;
import org.mixare.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainMenu extends Activity {

	private String name, level, experience;

	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.main_menu);

		TextView helloMsg = (TextView) findViewById(R.id.menu_hello);
		name = getIntent().getExtras().getString(Globals.USERNAME);
		level = getIntent().getExtras().getString(Globals.LEVEL);
		experience = getIntent().getExtras().getString(Globals.EXP);
		helloMsg.setText("hello " + name + "!");

		Button join = (Button) findViewById(R.id.menu_join_game);
		join.setOnClickListener(new OnClickListener() {


			public void onClick(View v) {
				Intent mixView = new Intent(MainMenu.this, MixView.class);
				mixView.putExtra("username", name);
				mixView.putExtra("level", level);
				mixView.putExtra("exp", experience);
				mixView.setAction(Intent.ACTION_VIEW);
				mixView.setDataAndType(Uri.parse(Globals.SERVER_ADR), "application/mixare-json");
				startActivity(mixView);
				finish();
			}
		});		
	}
}
